/**
 * @author SANmq
 * @description 根据不同的 valueType 类型快捷渲染对应的表单字段。后续根据业务形态进行增加。
 */
import { Input, InputProps, Select, SelectProps } from 'antd';

export interface ValueTypeProps {
  type?: 'input' | 'select';
  inputProps?: InputProps;
  selectProps?: SelectProps;
}

export function valueTypeRender({
  type,
  inputProps,
  selectProps,
}: ValueTypeProps) {
  if (type === 'input' || inputProps) {
    return <Input placeholder="请输入" allowClear {...inputProps} />;
  }
  if (type === 'select' || selectProps) {
    return <Select placeholder="请输入" allowClear {...selectProps} />;
  }
  return null;
}
